import React from 'react'
import * as echarts from 'echarts';
import {useEffect,useState} from "react"
import {useRef} from "react"
import {chartsobj} from "../data/charts"
import axios from 'axios';
function Dh3() {
  let mycharts = useRef(null)
  useEffect(()=>{
    console.log(mycharts.current);
    const myChart = echarts.init(mycharts.current);
    myChart.setOption(chartsobj);
    axios.get("/chartslist").then(res=>{
      myChart.setOption({
        xAxis:{
          data:res.data. x
        },
        series:[{
          data:res.data.data
        }]
      })
    })
  },[])
  return (
    <div>
       <div ref={mycharts} style={{height:"400px",width:"400px"}}>11</div>
    </div>
  )
}

export default Dh3